home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
graphic
/
frasr182.zip
/
FR8514A.ASM
< prev
next >
Wrap
Assembly Source File
|
1992-11-17
|
51KB
|
2,066 lines
IFDEF ??version
MASM51
QUIRKS
ENDIF
.MODEL medium,c
.8086
HOPEN equ 8
HSMX equ 9
HINT equ 16
HLDPAL equ 19
HBBW equ 21
HBBR equ 23
HBBCHN equ 24
HBBC equ 25
HQMODE equ 29
HRECT equ 32
HCLOSE equ 34
HINIT equ 48
HSYNC equ 49
HSPAL equ 57
HRPAL equ 58
HLINE equ 0
HSCOL equ 7
.DATA
extrn sxdots:word, sydots:word ; number of dots across and down
extrn dacbox:byte, daccount:word
afiptr dd 0
xadj dw 0
yadj dw 0
extrn paldata:byte ; 1024-byte array (in GENERAL.ASM)
extrn stbuff:byte ; 415-byte array (in GENERAL.ASM)
linedata db 0
hopendata db 3, 0, 0, 0, 0
hclosedata dw 2, 0
hinitdata dw 2, 0
bbw dw 10, 8, 0, 1, 0, 0
bbr dw 12, 8, 0, 1, 0, 0, 0
smx dw 2, 0
chn dw 6
dd linedata
dw 1
pal dw 10, 0, 0, 256
dd paldata
hidata dw 4, 0, 8000h
amode dw 18, 9 dup(?)
hlinedata dw 8, 0, 0, 0, 0
hscoldata dw 4, 0, 0
.CODE VIDEO_TEXT
callafi proc near
push ds ; Pass the parameter pointer
push si
shl ax,1 ; form offset from entry no. required
shl ax,1
mov si,ax
les bx, afiptr ; entry block address to es:bx
call dword ptr es:[bx][si] ; call entry point
ret ; return to caller
callafi endp
getafi proc near
mov ax,357fh ; read interrupt vector 7f
int 21h
mov ax,es
or ax,bx ; is 7f vector null
stc
jz getafiret
mov ax,0105h ; get Interface address
int 7fh ; by software interrupt 7f
jc getafiret ; Interface not OK if carry set
mov word ptr afiptr,dx ; save afi pointer offset
mov word ptr afiptr+2,cx ; save afi pointer segment
clc ; clear carry flag
getafiret:
ret ; return to caller
getafi endp
do85open proc near
push ax
mov ax, HOPEN
call callafi
mov ax, offset stbuff ;get the state segment
add ax, 15
mov cl, 4
shr ax, cl
mov bx, ds
add ax, bx
mov si, offset hinitdata
mov [si] + 2, ax
pop ax
call callafi
clc
ret
do85open endp
open8514 proc near
call load8514dacbox ; load dacbox for 8514/A setup JCO 4/6/92
call getafi ;get adapter interface
jc afinotfound
mov bl, 0 ;if > 640 x 480 then 1024 x 768
mov ax, sxdots
cmp ax, 1024 ;if > 1024, don't use afi, JCO 4/4/92
ja afinotfound
cmp ax, 800 ; must be 1024
ja setupopen
cmp ax, 640 ; could be 800
ja afinotfound
mov ax, sydots
cmp ax, 480
ja setupopen
inc bl
setupopen:
mov si, offset hopendata ;open the adapter
mov byte ptr [si + 2], 40h ;zero the image but leave pallette
mov [si + 3], bl
mov ax, HINIT ;initialize state
call do85open
jc afinotfound
mov si, offset amode ;make sure on the size
mov ax, HQMODE ;get the adapter mode
call callafi
mov ax, amode + 10 ;get the screen width
cmp ax, sxdots
jae xdotsok ;check for fit
mov sxdots, ax
xdotsok:
sub ax, sxdots ;save centering factor
shr ax, 1
mov xadj, ax
mov ax, amode + 12 ;get the screen height
cmp ax, sydots
jae ydotsok
mov sydots, ax
ydotsok:
sub ax, sydots
shr ax, 1
mov yadj, ax
clc
ret
afinotfound: ; No 8514/A interface found
stc ; flag bad mode
ret ; and bail out
open8514 endp
reopen8514 proc near
mov si, offset hopendata ;open the adapter
mov byte ptr [si + 2], 0C0h ;zero the image but leave pallette
mov ax, HSYNC ;initialize state
call do85open
ret
reopen8514 endp
close8514 proc near
mov si, offset hclosedata ;turn off 8514a
mov ax, HCLOSE
call callafi
ret
close8514 endp
fr85wdotnew proc near uses si
mov byte ptr [hscoldata + 2], al
add cx, xadj
add dx, yadj
mov hlinedata + 2, cx
mov hlinedata + 4, dx
inc cx ; increment x direction
mov hlinedata + 6, cx
mov hlinedata + 8, dx
; set the color
mov si, offset hscoldata
mov ax, HSCOL
call callafi
; plot the point
mov si, offset hlinedata
mov ax, HLINE
call callafi
ret
fr85wdotnew endp
fr85wdot proc near uses si
mov linedata, al
mov bbw + 4, 1 ;define the rectangle
; mov bbw + 6, 1
add cx, xadj
add dx, yadj
mov bbw + 8, cx
mov bbw + 10, dx
mov si, offset bbw
mov ax, HBBW
call callafi
mov si, offset chn
mov word ptr [si + 2], offset linedata
mov word ptr [si + 6], 1 ;send the data
mov ax, HBBCHN
call callafi
fr85wdotx:
ret
fr85wdot endp
fr85wbox proc near uses si
sub ax, cx
inc ax ; BDT patch 11/4/90
; add ax, xadj
add cx, xadj
add dx, yadj
mov chn + 2, si ;point to data
mov chn + 6, ax
mov bbw + 4, ax ;define the rectangle
; mov bbw + 6, 1 ;set in declaration
mov bbw + 8, cx
mov bbw + 10, dx
mov si, offset bbw
mov ax, HBBW
call callafi
mov si, offset chn
mov ax, HBBCHN
call callafi
ret
fr85wbox endp
fr85rdot proc near uses si
mov bbr + 4, 1 ;define the rectangle
; mov bbr + 6, 1 ;set in declaration
add cx, xadj
add dx, yadj
mov bbr + 10, cx
mov bbr + 12, dx
mov si, offset bbr
mov ax, HBBR
call callafi
mov si, offset chn
mov word ptr [si + 2], offset linedata
mov word ptr [si + 6], 1 ;send the data
mov ax, HBBCHN
call callafi
mov al, linedata
fr85rdotx:
ret
fr85rdot endp
fr85rbox proc near uses si
sub ax, cx
inc ax ; BDT patch 11/4/90
; add ax, xadj
add cx, xadj
add dx, yadj
mov chn + 2, di ;point to data
mov chn + 6, ax
mov bbr + 4, ax ;define the rectangle
; mov bbr + 6, 1 ;set in declaration
mov bbr + 10, cx
mov bbr + 12, dx
mov si, offset bbr
mov ax, HBBR
call callafi
mov si, offset chn
mov ax, HBBCHN
call callafi
ret
fr85rbox endp
w8514pal proc near
mov si, offset dacbox
mov cx, daccount ;limit daccount to 128 to avoid fliker
cmp cx, 128
jbe countok
mov cx, 128
mov daccount, cx
countok: ;now build 8514 pallette
mov ax, 256 ;from the data in dacbox
mov pal + 4, 0
mov di, offset paldata
cld
cpallp:
push ax ;do daccount at a time
mov dx, di
cmp ax, cx
jae dopass
mov cx, ax
dopass:
mov pal + 6, cx ;entries this time
push cx
cpallp2:
push ds ;pallette format is r, b, g
pop es ;0 - 255 each
lodsb ;red
shl al, 1
shl al, 1
stosb
lodsb ;green
shl al, 1
shl al, 1
xchg ah, al
lodsb ;blue
shl al, 1
shl al, 1
stosw
mov al, 0 ;filler
stosb
loop cpallp2
push si
push di
push dx
mov si, hidata ;wait for flyback
mov ax, HINT
call callafi
pop dx
mov pal + 8, dx
mov si, offset pal ;load this piece
mov ax, HLDPAL
call callafi
pop di
pop si
pop cx
add pal + 4, cx ;increment the pallette index
pop ax
sub ax, cx
jnz cpallp
ret
w8514pal endp
;********************************************************************
;* 8514/A Hardware Interface Routines
;* Written by Aaron M. Williams for Fractint
;* This code may be used freely by anyone for anything and freely distributed.
;* All routines here are written for a V20 (80186) or better CPU.
;* All code has been at least partially optimized for a 486 (i.e. pipelining)
;* The macros were written by Roger Brown for Adex Corporation and have been
;* placed into the public domain by Adex corporation.
;*
;* Special support has been added for the Brooktree RAMDAC, which uses 8
;* bits for rgb values instead of 6 bits. This RAMDAC is used only in the
;* 1280x1024 mode (unless programmed otherwise)
;*
;* Completed on 3/8/92
;* Revised by JCO on 4/12/92
; changed width to wdth and other minor fixes so it would assemble
; using MASM 6.0
; took out duplicate variables, xadj, yadj, linedata
; took out .model C
; added VIDEO_TEXT to .code and made procedures near
; added TRANSY macro for 640x480x16 (512K), but not used
; w8514hwpal
; Changed normal 8514/A routine to slow it down
; reopen8514hw
; Renamed enableHIRES as reopen8514hw
; Commented out old reopen8514hw
; open8514hw
; Changed where board is reset so a hung board won't prevent detect of 8514/A
; Added load8514dacbox routine to initialize colors
; Added detection and setup of 512K 8514/A, use debug=8514 to test on 1 Meg
; Changed foreground m